<?php
function iHaveError($object) {
    return $object->iDontExist();
}

try {
    iHaveError(null);
} catch (\Error $e) {
    echo $e->getMessage();
}